package com.smartcampusbackend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smartcampusbackend.model.InterestCommunity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface InterestCommunityMapper extends BaseMapper<InterestCommunity> {
    
    // 根据分类获取社群列表
    List<InterestCommunity> findByCategory(@Param("category") String category);
    
    // 获取用户创建的社群
    List<InterestCommunity> findByCreatorId(@Param("creatorId") Integer creatorId);
    
    // 获取用户加入的社群
    List<InterestCommunity> findUserJoinedCommunities(@Param("userId") Integer userId);
    
    // 更新成员数量
    int updateMemberCount(@Param("communityId") Integer communityId, @Param("memberCount") Integer memberCount);
    
    // 更新帖子数量
    int updatePostCount(@Param("communityId") Integer communityId, @Param("postCount") Integer postCount);
} 